/**
 * Created by Administrator on 2016/5/5.
 */
var http = require('http');

// 使用event listener重构代码
var server = http.createServer();
server.on('request', function (req, resp) {
    resp.writeHead(200,{
        'Content-Type' : 'text-html'
    });
    resp.end('Hello, Welcome to Node.js, CJD');
});

// 当server关闭时，打印消息
server.on('close', function () {
    console.log('Server is closed...');
});

server.listen(8080);
